<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>实例对象</title>
    <script src="https://cdn.jsdelivr.net/npm/axios@1.1.2/dist/axios.min.js"></script>
</head>
<body>
<script>
    const instance = axios.create({
        baseURL: 'http://localhost:3000',
        timeout: 2000
    });
    //instance与axios相似
    instance({
        url: 'posts/1'
    }).then(response => {
        console.log(response)
    })
</script>
</body>
</html>